<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let a = function(){
            console.log(1);
        };

        a();

        // 定义的函数不调用是不会运行的
        function show(){
            console.log("show")
        }
        show();

        // 定义带参的箭头函数
        var fn1 = (a, b) => {
            return a + b;
        }

        var fn2 = () => {
            return 40;
        }

        console.log(fn1(10,20))


        // document.onclick = () => {
        //     console.log(this); //window
        // };

        function fn() {
            setTimeout(() => {
            console.log(this);
        }, 1000);}
        //document.onclick = fn; 的时候输出document ; fn()的时候输出window
        fn();
        document.onclick = fn;







    </script>
</body>
</html>